<?php
/**
* （6W2102）全国代发代扣文件上传
*/
class Conf6w2102 extends Abccbconf
{
    public function getTransaction()
    {
        $this->_ccbConf->getTransactionHeader();
    }

    public function getTransactionBody()
    {
        /**
         *  上传文件名 varChar(256)
         */
        $body['SEND_FILE'] = $this->parameter['SEND_FILE'];

        return $body;
    }

    /**
     * 验证
     */
    public function validateParameter()
    {
        if ( empty($this->parameter['SEND_FILE']) ) {
            throw new Exception("请输入要上传文件", 1);
        }
    }

    /**
     * 解析
     */
    public function parsesResult($response)
    {
        $transaction = array();
        $transaction['message'] = (string)$response->RETURN_MSG;
        $transaction['response_content'] = json_encode($response);
        if ( (string)$response->RETURN_CODE === '000000' ) { // 验证是否转账成功
            $transaction['send_file'] = (string)$response->TX_INFO->SEND_FILE; //网银上传文件名
            $transaction['status'] = 3; //交易成功
        } else {
            $transaction['status'] = 2; //交易失败
        }

        return $transaction;
    }
}